<!--#include file="Config.asp"-->
<!--#include file="emp_is.asp"-->
<!--#include file="Header.asp"-->

<script language=Javascript>

//批量选择选项
function check_all(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name != 'chkall')
       e.checked = form.chkall.checked;
    }
  }

</script>

<%

'保存明细数据到数据库
''获取传递过来的信息参数
if request("act")="add" then
Set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from CMDB_BorrowLog where ID is null"
rs.open sql,conn,1,3
rs.addnew
rs("emp_id")=session("emp_ID") 'IT
rs("topic")=Trim(request("topic")) '责任人
rs("Dep_ID")=int(request("Dep_ID")) '品牌
rs("SKUID")=Int(request("SKUID")) '
rs("Logdate")=Now()  '时间
rs("Num")=trim(request("Num")) '数量
rs("danwei")=int(request("danwei")) '单位
rs("info")=Trim(request("info")) ' 说明
rs.Update
rs.close

'response.redirect Request.ServerVariables("Http_referer")
'执行数据写入到表结束
end if
'--------------------------------数据输入HTML部分
%>
<!--－－－－－－－－－－－－－－－－－－－－－－－－－－－－－ 等 -->
<table class="table table-condensed table-hover table-striped table-bordered">
<FORM METHOD=POST ACTION="">
<TR >
<TD>
<SELECT NAME="BrandID">
<option value="0">＝品牌＝</option>
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select distinct id,name from Basic_Brand order by id "
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=trim(rsb("id"))%>" <% if int(session("BrandID"))=int(trim(rsb("ID"))) then response.Write("selected") %>> <%=rsb("name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
<SELECT NAME="StockType">
<option value="0">＝分类＝</option>
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select distinct type_id,type_name from CMDB_Type where type_fatherid<>0 order by type_id desc"
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=trim(rsb("type_id"))%>" <% if int(session("type_ID"))=int(trim(rsb("type_ID"))) then response.Write("selected") %>> <%=rsb("type_name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
<SELECT NAME="AssetFrom">
<option value="0">＝来源＝</option>
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select id,name from CMDB_From order by id "
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=trim(rsb("id"))%>" > <%=rsb("name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
<SELECT NAME="AssetState">
<option value="0">＝状态＝</option>
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select id,name from CMDB_State  where id<>2 and id<>7 and id<>113 order by id"
	' id=2 使用中 7 已经领用 113 采购中
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=trim(rsb("id"))%>" > <%=rsb("name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
<INPUT TYPE="submit"value="查询暂时失效" >
</TD>
</TR>
</FORM>
</table>
<!---------明细数据HTML部分开始 ----------------------------------->
<table class="table table-condensed table-hover table-striped table-bordered">
<TR>
	<TH>IT物资</TH>
	<TH>领用人/部门</TH>
	<TH>数量/单位</TH>
	<TH>Info</TH>
	<TH>时间/操作</TH>
</TR>
<%
set rslist= server.createobject("adodb.recordset")
sql_list= "select * from CMDB_BorrowLog where 1=1 "
sql_list=sql_list&sqlt
sql_list=sql_list&" order by ID desc"
rslist.open sql_list,conn,3
if pmcount="" or isempty(pmcount) or pmcount<1 then
        pmcount=10 '每页记录数
end if
rslist.pagesize=pmcount   	'设置每页数
mpage=rslist.pagecount    	'得到总页数
pageno=request("pageno")
if len(pageno)=0 or int(pageno)<1 or int(pageno)>mpage then
	pageno=1
end if
if not (rslist.eof or err) then
rslist.absolutepage=pageno	'将指针移至指定页的第一条记录
loopno=pmcount
do while not (rslist.eof or err) and loopno>0
'ShowIDURL="MSMod.asp?MSNO="&rslist("MSNO")
%>
<TR <%If (loopno Mod 2)=0 then%>bgcolor='#f6f6f6'<%else%>bgcolor='#ffffff'<%End if%>>
<TD><A HREF="CMDB_View.asp?SKUID=<%=int(Trim(rslist("SKUID")))%>" title='编辑SKU所有日志记录' target="_blank"><%=Trim(rslist("SKUID"))%>.<%=Trim(showSkuName(rslist("SKUID")))%></A></TD>
<TD><%=Trim(rslist("topic"))%>.<%=GetDepName(rslist("Dep_ID"))%></TD>
<TD><%=Trim(rslist("num")&getDanWei(rslist("danwei")))%></TD>
<TD><%=Trim(rslist("info"))%></TD>
<TD><%=GetEMPName(int(rslist("EMP_ID")))%>.<%=Trim(rslist("logdate"))%></TD>
</TR>
<%
rslist.movenext
loopno=loopno-1
loop
rslist.close
%>
<!-- 翻页------------------------------- -->
<TR bgcolor='#CCFFFF' >
<TD colspan='7' align='right' style="BORDER-top: #999999 1px solid;">
<%IF pageno<>1 then%>
<A HREF="?pageno=1&Keyword=<%=Keyword%>&Type=<%=S_Type%>">
[首页]</A>
<%
End If
%>
<%IF pageno>1 then%>
<A HREF="?pageno=<%=pageno-1%>&Keyword=<%=Keyword%>&Type=<%=S_Type%>">
[上一页]</A>
<%
End if
IF pageno<>mpage then
%>
<A HREF="?pageno=<%=pageno+1%>&Keyword=<%=Keyword%>&Type=<%=S_Type%>">
[下一页]</A>
<%
End if
%>
<%IF pageno<>mpage then%>
<A HREF="?pageno=<%=mpage%>&Keyword=<%=Keyword%>&Type=<%=S_Type%>">
[末页]</A>
<%
End If
%>
[<%=pageno%>/<%=mpage%>]
</TD>
</TR>
<!-- 翻页------------------------------- -->
</TABLE>
<!-- ----------结束 -->
<%
end if
Set rs=Nothing
%>

<!-- 耗材领借用登记 /////////////////////////////////////////////////////////////////////////////////////////////////////////-->
<table class="table table-condensed table-hover table-striped table-bordered">
<TR bgcolor='#ddeeff'>
<td>SKUID</td>
<td>数量/单位</td>
<td>领用人/部门</td>
<td>用途/备注</td>
<td>操作</td>
</tr>
<FORM METHOD=POST ACTION="?act=add">
<TR>
<td>
<SELECT NAME="SKUID">
<%
StockType="69,74,76,77,85,86,92"
set rslist= server.createobject("adodb.recordset")
sql_list= "select * from cmdb_List where stocktype in ("&StockType&") order by stocktype,skuid "
rslist.open sql_list,conn,3
For g=1 To rslist.recordcount
%>
<OPTION VALUE="<%=int(rslist("SKUID"))%>" ><%=Trim(rslist("SKUID"))%>.<%=Trim(showSkuName(rslist("SKUID")))%></option>
<%
rslist.movenext
Next
rslist.close
%>
</SELECT>
</td>
<td>
<SELECT NAME="Num">
<%
For n=1 To 20
%>
<OPTION VALUE="<%=n%>" ><%=n%></option>
<%
Next
%>
</SELECT>
<SELECT NAME="danwei">
<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select id,name from basic_danwei order by id"
	' id=2 使用中 7 已经领用 113 采购中
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%>
<option value="<%=int(rsb("id"))%>" ><%=rsb("name")%></option>
<%
rsb.movenext
next
end if
set rsb=nothing
%>
</SELECT>
</td>
<td>
<INPUT TYPE="text" NAME="topic" size='8'>
<SELECT NAME="Dep_ID" >
<%
rss.open "select * from basic_company order by CompanyID",conn,1,1
for c=1 to rss.recordcount
%>
<optgroup label="<%=trim(rss("ComOrder"))%>.<%=trim(rss("Company"))%>">
<%
set rs=Server.CreateObject("ADODB.Recordset")
rs.open "select Dep_ID,Dep_name,Dep_order from emp_dep where Dep_isshow=1 and CompanyID="&int(rss("CompanyID"))&" order by Dep_order",conn,1,1
for d=1 to rs.recordcount
%>
<option value="<%=int(rs("Dep_ID"))%>"><%=trim(rss("ComOrder"))%>.<%=trim(rs("Dep_order"))%>.<%=trim(rs("Dep_name"))%></option><%
rs.movenext
next
rs.close


rss.movenext
next
rss.close

%>
</SELECT>

</td>
<td><INPUT TYPE="text" NAME="info"></td>
<td>
<INPUT TYPE="submit" value='<%=session("Emp_Name")%>提交'>
</td>
</tr>
</FORM>
</TABLE>
<!-- 耗材领借用登记 /////////////////////////////////////////////////////////////////////////////////////////////////////////-->
<table class="table table-condensed table-hover table-striped table-bordered">
<TR bgcolor='#00CCFF'>
<td>注：</td>
</tr><tr bgcolor='#ddeeff'>
<TD>
1.耗件状态：[<%
	set rsb= server.createobject("adodb.recordset")
	sql_s= "select id,name from CMDB_State  where id<>2 and id<>7 and id<>113 order by id"
	' id=2 使用中 7 已经领用 113 采购中
	rsb.open sql_s,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%><%=rsb("name")%>/<%
rsb.movenext
next
end if
set rsb=nothing
%>
]<BR>
2.耗件分类：[<%
set rsb= server.createobject("adodb.recordset")
sql= "select * from CMDB_Type where type_ID in ("&StockType&") order by type_id"
	rsb.open sql,conn,3
	if not rsb.eof then
	 for i=1 to rsb.recordcount
%><%=rsb("type_id")%>.<%=rsb("type_name")%>/<%
rsb.movenext
next
end if
set rsb=nothing
%>]
</TD>
</tr>
</table>
<%
Set conn=nothing
'End If '权限配置结束
%>
<!--#include file="Footer.asp" -->
